<ui:component xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:m="http://www.ol4jsf.org"
	xmlns:a4j="http://richfaces.org/a4j">

	<style>
		.noMaskClass .rich-mpnl-mask-div {
			display:none;
		}
		.contentEditData {
			width:100%;
			height:290px;
			overflow:auto;
		}
	</style>
	
	<rich:modalPanel id="editDataPanelToolbox" width="400" height="460" styleClass="noMaskClass" zindex="10000">
		<f:facet name="header">
			<h:outputText value="#{messages['dataentry.editdata_toolbox_desc']}"/>
		</f:facet>
		
		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage value="/img/close.png" styleClass="hidelink"
					id="hideEditDataPanel" />
				<rich:componentControl for="editDataPanelToolbox" attachTo="hideEditDataPanel"
					operation="hide" event="onclick" />
			</h:panelGroup>
		</f:facet>
		
		<h:form id="frmEditData">
			<ui:include src="./includes/selectedParcelTlb.xhtml" />
			<br />
			<h:messages />
			<rich:tabPanel id="editDataTabPanel" switchType="client" selectedTab="firstTab">
				<rich:tab name="firstTab" label="#{messages['dataentry.editdata.legal_section']}">
					<div class="contentEditData">
						<h:panelGrid id="editDataTab1" columns="2">
							<h:outputText value="#{messages['dataentry.editdata.parcel_name']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.zoneName}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.geometry_area']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.geometryArea}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>
						
							<h:outputText value="#{messages['dataentry.editdata.documented_area']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.documentedArea}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>
						
							<h:outputText value="#{messages['dataentry.editdata.measured_area']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.measuredArea}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>
						
							<h:outputText value="#{messages['dataentry.editdata.documented_built_area']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.documentedBuiltArea}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>
						
							<h:outputText value="#{messages['dataentry.editdata.ground_built_area']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.groundBuiltArea}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>
						
							<h:outputText value="#{messages['dataentry.editdata.neighborhood']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.neighborhood}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.access_way1']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.accessWay1}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.access_way2']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.accessWay2}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.house_number']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.houseNumber}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.location_in_country']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.locationInCountry}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>
						</h:panelGrid>
					</div>
				</rich:tab>
				<rich:tab label="#{messages['dataentry.editdata.tax_section']}">
					<div class="contentEditData">
						<h:panelGrid id="editDataTab2" columns="2">
							<h:outputText value="#{messages['dataentry.editdata.commercial_appraisal']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.commercialAppraisal}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.fiscal_appraisal']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.fiscalAppraisal}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.payed_taxes']}" />
							<h:inputText value="#{dataEntryHelper.selectedParcel.payedTaxes}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}"/>

							<h:outputText value="#{messages['dataentry.editdata.status']}" />
							<h:selectOneMenu value="#{dataEntryHelper.selectedParcel.status}" disabled="#{not dataEntryHelper.parcelDataHelper.editing}">
								<f:selectItems value="#{dataEntryHelper.parcelDataHelper.taxStatusTypes}"/>
							</h:selectOneMenu>
						</h:panelGrid>
					</div>
				</rich:tab>
				<rich:tab label="#{messages['dataentry.editdata.landuse_section']}">
					<div class="contentEditData">
						<h:panelGrid id="editDataTab3" columns="2">
							<h:outputText value="#{messages['dataentry.editdata.current_landuse']}" />
							<h:inputTextarea id="nameCurrentLandUse"
								readonly="true"
								value="#{dataEntryHelper.parcelDataHelper.currentLandUseName}"
								style="width:100%"
								rows="2"
								disabled="#{not dataEntryHelper.parcelDataHelper.editing}"
								ondblclick="selectCurrentLandUse();">
							</h:inputTextarea>

							<h:outputText value="#{messages['dataentry.editdata.proposed_landuse']}" />
							<h:inputTextarea id="nameProposedLandUse"
								readonly="true"
								value="#{dataEntryHelper.parcelDataHelper.proposedLandUseName}"
								style="width:100%"
								rows="2"
								disabled="#{not dataEntryHelper.parcelDataHelper.editing}"
								ondblclick="selectProposedLandUse();">
							</h:inputTextarea>
						</h:panelGrid>
					</div>
				</rich:tab>
			</rich:tabPanel>
			
			<br />
			
			<div align="center">
				<h:panelGroup id="editSaveBtns">
					<a4j:commandButton value="#{messages['button.edit']}" immediate="true"
						action="#{dataEntryHelper.parcelDataHelper.beginEditData}"
						rendered="#{not dataEntryHelper.parcelDataHelper.editing}"
						reRender="transactionCnts,editDataTab1,editDataTab2,editDataTab3,editSaveBtns">
					</a4j:commandButton>
					
					<a4j:commandButton value="#{messages['button.save']}"
						action="#{dataEntryHelper.parcelDataHelper.applyDataChange}"
						rendered="#{dataEntryHelper.parcelDataHelper.editing}"
						reRender="transactionCnts,editDataTab1,editDataTab2,editDataTab3,editSaveBtns">
					</a4j:commandButton>
					#{'  '}
					<a4j:commandButton value="#{messages['button.cancel']}" immediate="true"
						action="#{dataEntryHelper.parcelDataHelper.cancelEditData}"
						rendered="#{dataEntryHelper.parcelDataHelper.editing}"
						reRender="transactionCnts,editDataTab1,editDataTab2,editDataTab3,editSaveBtns">
					</a4j:commandButton>
				</h:panelGroup>
			</div>
		</h:form>
		
		<h:form>
			<a4j:jsFunction
				name="selectCurrentLandUse"
				action="#{selectLandUseHelper.setInputFields('frmEditData:nameCurrentLandUse', 'frmEditData:nameCurrentLandUse')}"
				reRender="frmSelectLandUse"
				oncomplete="#{rich:component('selectLandUsePanel')}.show()">
				<f:setPropertyActionListener
					target="#{selectLandUseHelper.landUseField}"
					value="dataEntryHelper.selectedParcel.currentLandUse">
				</f:setPropertyActionListener>
			</a4j:jsFunction>
			<a4j:jsFunction
				name="selectProposedLandUse"
				action="#{selectLandUseHelper.setInputFields('frmEditData:nameProposedLandUse', 'frmEditData:nameProposedLandUse')}"
				reRender="frmSelectLandUse"
				oncomplete="#{rich:component('selectLandUsePanel')}.show()">
				<f:setPropertyActionListener
					target="#{selectLandUseHelper.landUseField}"
					value="dataEntryHelper.selectedParcel.proposedLandUse">
				</f:setPropertyActionListener>
			</a4j:jsFunction>
		</h:form>
	</rich:modalPanel>

	<ui:include src="/WEB-INF/includes/selectLandUse.xhtml" />
</ui:component>

